﻿using Domain.Entities.Stocks;
using FluentMigrator;
using FrameworkCore.Extensions;

namespace AiBLSmartEdu.Module.SmartStockSense.API.Migrations;

[Migration(202410111646)]
public class StockInformationAddColumn : ForwardOnlyMigration
{
    public override void Up()
    {
        Alter.Table(MigrationExpressions.GetTableName(typeof(StockInformation)))
            .AddColumn(MigrationExpressions.ColumnNameFor<StockInformation>(nameof(StockInformation.StockId))).AsInt64().WithColumnDescription("外键：关联的股票StockID。")
            .AddColumn(MigrationExpressions.ColumnNameFor<StockInformation>(nameof(StockInformation.Timestamp))).AsDateTime().WithColumnDescription("时间戳。")
            .AddColumn(MigrationExpressions.ColumnNameFor<StockInformation>(nameof(StockInformation.Type))).AsInt32().Nullable().WithColumnDescription("数据类型")
            .AddColumn(MigrationExpressions.ColumnNameFor<StockInformation>(nameof(StockInformation.JSON))).AsString(int.MaxValue).WithColumnDescription("JSON数据");
    }
}
